$md: (
  ) !default;
$md: map-merge((hrColor: #ddd,
      blockquoteBg: #f6f8fa,
      color-blockquote: #f6f8fa,
      blockquoteBorderColor: #ccc,
      markBg: yellow,
      kbdBg: #fafbfc,
      singleLineCoodeBg: #eeeeee,
      singleLineCoodeColor: #15a7a7,
      detailsBg: #fafafa,
      detailsBorderColor: #eaeaea,
      detailsActiveBorderColor: rgb(234, 234, 234),
      code-font: "Menlo,Monaco,Consolas,'Courier New', monospace",
      iframe-height: 40vw,
    ),
    $md
);

$color-hr: map-get($md, hrColor);
$color-blockquote-bg: map-get($md, blockquoteBg);
$color-blockquote: map-get($md, color-blockquote);
$color-blockquote-border: map-get($md, blockquoteBorderColor);
$color-mark-bg: map-get($md, markBg);
$color-kbd-bg: map-get($md, kbdBg);
$color-singlelinecode-bg: map-get($md, singleLineCoodeBg);
$color-singlelinecode: map-get($md, singleLineCoodeColor);
$color-details-bg: map-get($md, detailsBg);
$details-border-color: map-get($md, detailsBorderColor);
$details-active-border-color: map-get($md, detailsActiveBorderColor);
$font-code: map-get($md, code-font);
$height-iframe: map-get($md, iframe-height);

// tinymce5
// Markdown
#cnblogs_post_body.blogpost-body-html,
#mainContent .cnblogs-markdown {
  word-break: break-word;
  line-height: 1.75;
  font-weight: 400;
  font-size: 15px;

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    line-height: 1.5;
    margin: 35px 0 10px;
    padding: 0 0 5px 0;
  }

  h1 {
    font-size: 30px;
    margin-bottom: 5px;
  }

  h2 {
    padding-bottom: 12px;
    font-size: 24px;
  }

  h3 {
    font-size: 18px;
    padding-bottom: 0;
  }

  h4 {
    font-size: 16px;
  }

  h5 {
    font-size: 15px;
  }

  h6 {
    margin-top: 5px;
  }

  img {
    display: flex;
    margin: 10px auto;
    max-width: 100% !important;
    border-radius: 2px;
  }

  hr {
    margin: 32px 0;
    border: none;
    border-bottom: 1px solid $color-hr;
  }

  a {
    color: #47a1f6;

    &:hover {
      color: #68b5fb;
    }
  }

  ol {
    list-style: auto;
  }

  ul {
    list-style: disc;
  }

  ol,
  ul {
    margin: 22px 0;
    padding: 0 0 0 28px;

    li {
      margin-bottom: 0;
    }

    ul,
    ol {
      margin-top: 4px;
    }
  }

  blockquote {
    margin: 22px 0;
    padding: 2px 22px;
    color: $color-blockquote;
    background: $color-blockquote-bg;
    border-left: 4px solid $color-blockquote-border;

    &::after {
      display: block;
      content: '';
    }

    &>p {
      margin: 10px 0;
    }
  }

  details {
    margin: 1.5rem 0;
    padding: 0.5rem 1rem;
    background: $color-details-bg;
    border-radius: 2px;
    border: 1px solid;
    border-color: $details-border-color;

    &>summary {
      font-weight: 500;
      outline: none;
      cursor: pointer;
    }

    &[open] {
      border: 1px solid $details-active-border-color;
    }
  }

  iframe {
    width: 100%;
    height: $height-iframe;

    &.music {
      width: auto;
      height: auto;
    }
  }
}

// Markdown
#mainContent .cnblogs-markdown {
  kbd {
    display: inline-block;
    padding: 3px 5px;
    font: 11px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
    line-height: 10px;
    color: #444d56;
    vertical-align: middle;
    background-color: $color-kbd-bg;
    border: 1px solid #d1d5da;
    border-radius: 2px;
    box-shadow: inset 0 -1px 0 #d1d5da;
  }

  mark {
    background-color: $color-mark-bg;
  }
}

// singleline code
.cnblogs-markdown :not(pre, div, td)>code,
.blogpost-body :not(pre, div, td)>code {
  display: inline;
  padding: 0.065em 0.4em;
  background-color: $color-singlelinecode-bg;
  border-radius: 2px;
  overflow-x: auto;
  font-size: 0.87em;
  font-family: $font-code;
  color: $color-singlelinecode;
  word-break: break-word;
}

pre[class*='language-'].highlighter-prismjs,
pre code.hljs {
  border-radius: 2px;
}

// code toolbar
span.cnb-code-toolbar-item {
    color: var(--geek-color-9);
    background: var(--geek-color-3);
    mix-blend-mode: normal;
    opacity: 1;
}

// table start
#cnblogs_post_body th,
.cnblogs-post-body th {
  background: none;
}

// table end
.blogpost-body th,
.blogpost-body td,
.cnblogs-post-body th,
.cnblogs-post-body td {
  border-color: $details-border-color;
}

@media screen and (max-width: 1023px) {
  iframe {
    height: 60vw;
  }
}

@media screen and (max-width: 768px) {
  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  h3 {
    font-size: 18px;
  }

  #cnblogs_post_body,
  .cnblogs-post-body,
  .cnblogs-markdown {
    iframe {
      height: 50vw;
    }
  }
}
